home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 25 / AMIGAplus Sonderheft 25 (2000)(Falke)(DE)(Track 1 of 4)[!].iso / PublicDomain / Anwendungen / FloatingClock / Source / digits.c next >
C/C++ Source or Header  |  1998-06-16  |  6KB  |  172 lines

  1. /***********************
  2.  *                       *
  3.  *    Digits for Fclock. *
  4.  *                       *
  5.  ***********************/
  6.  
  7. #include <exec/types.h>
  8. #include <clib/exec_protos.h>
  9. #include <clib/intuition_protos.h>
  10. #include "digits.h"
  11.  
  12. /**************************************************/
  13. /* Arrays of co-ordinates, and border definitions */
  14. /* to render the seven segment display digits.       */
  15. /**************************************************/
  16.  
  17. /* Co-Ords for the horizontal segment */
  18. /* border and filler lines!           */
  19. SHORT lthor_segment[]={ 0, 2, 2, 0, 10, 0, 11, 1 };
  20. SHORT dkhor_segment[]={ 1, 3, 2, 4, 10, 4, 12, 2 };
  21. SHORT hfiller[]={ 2, 1, 10, 1, 11, 2, 1, 2, 2, 3, 10, 3 };
  22. struct Border hor_border_seg=
  23.     { 0, 0, 1, 0, JAM1, 4, dkhor_segment, NULL };
  24. struct Border hor_border2=
  25.     { 0, 0, 2, 0, JAM1, 4, lthor_segment, &hor_border_seg };
  26. struct Border hfiller_border=
  27.     { 0, 0, 8, 0, JAM1, 6, hfiller, &hor_border2 };
  28.  
  29. /* Co-Ords for the vertical segment */
  30. /* border and filler lines!            */
  31. SHORT ltver_segment[]={ 0, 10, 0, 2, 2, 0, 3, 1 };
  32. SHORT dkver_segment[]={    4, 2, 4, 10, 2, 12, 1, 11 };
  33. SHORT vfiller[]={ 1, 2, 1, 10, 2, 11, 2, 1, 3, 2, 3, 10 };
  34. struct Border ver_border_seg=
  35.     { 0, 0, 1, 0, JAM1, 4, dkver_segment, NULL };
  36. struct Border ver_border2=
  37.     { 0, 0, 2, 0, JAM1, 4, ltver_segment, &ver_border_seg };
  38. struct Border vfiller_border=
  39.     { 0, 0, 8, 0, JAM1, 6, vfiller, &ver_border2 };
  40.  
  41. /* Co-Ords for the deviding dots */
  42. /* border and filler lines!      */
  43. SHORT ltdots[]={ 2, 0, 1, 0, 0, 1, 0, 2 };
  44. SHORT dkdots[]={ 1, 3, 2, 3, 3, 2, 3, 1 };
  45. SHORT dfiller[]={ 1, 1, 2, 1, 2, 2, 1, 2 };
  46. struct Border dots_border=
  47.     { 0, 0, 2, 0, JAM1, 4, ltdots, NULL };
  48. struct Border dots2=
  49.     { 0, 0, 1, 0, JAM1, 4, dkdots, &dots_border };
  50. struct Border dfiller_border=
  51.     { 0, 0, 8, 0, JAM1, 4, dfiller, &dots2 };
  52.  
  53. /* Prototype decs.. 
  54. void number_one(int, struct Window *);
  55. void number_two(int, struct Window *);
  56. void number_three(int, struct Window *);
  57. void number_four(int, struct Window *);
  58. void number_five(int, struct Window *);
  59. void number_six(int, struct Window *);
  60. void number_seven(int, struct Window *);
  61. void number_eight(int, struct Window *);
  62. void number_nine(int, struct Window *);
  63. void number_zero(int, struct Window *);
  64. void dots(struct Window *);
  65. */
  66.  
  67. /****************************************
  68.  *                                        *
  69.  * Definitions for the different numbers*
  70.  * made by the segments...                *
  71.  *                                        *
  72.  * Note: top_hor = x+3 and Y            *
  73.  *          mid_hor = x+3 and Y+14            *
  74.  *         bot_hor = X+3 and Y+28            *
  75.  *         top_ver = Y+3  (x+14 for RHS)  *
  76.  *          bot_ver = Y+17                    *
  77.  ****************************************/
  78.  
  79. void number_one(int xoffset, struct Window *win)
  80. {
  81.     DrawBorder( win->RPort, &vfiller_border, xoffset+14, Y+3 );
  82.     DrawBorder( win->RPort, &vfiller_border, xoffset+14, Y+17 );
  83. }
  84.  
  85. void number_two(int xoffset, struct Window *win)
  86. {
  87.     DrawBorder( win->RPort, &hfiller_border, xoffset+3,     Y );
  88.     DrawBorder( win->RPort, &vfiller_border, xoffset+14, Y+3 );
  89.     DrawBorder( win->RPort, &hfiller_border, xoffset+3,     Y+14 );
  90.     DrawBorder( win->RPort, &vfiller_border, xoffset,    Y+17 );
  91.     DrawBorder( win->RPort, &hfiller_border, xoffset+3,     Y+28 );
  92. }
  93.  
  94. void number_three(int xoffset, struct Window *win)
  95. {
  96.     DrawBorder( win->RPort, &hfiller_border, xoffset+3,    Y );
  97.     DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+3 );
  98.     DrawBorder( win->RPort, &hfiller_border, xoffset+3,    Y+14 );
  99.     DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+17 );
  100.     DrawBorder( win->RPort, &hfiller_border, xoffset+3,    Y+28 );
  101. }
  102.  
  103. void number_four(int xoffset,  struct Window *win)
  104. {
  105.     DrawBorder( win->RPort, &vfiller_border, xoffset,   Y+3 );
  106.     DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+3 );
  107.     DrawBorder( win->RPort, &hfiller_border, xoffset+3,    Y+14 );
  108.     DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+17 );
  109. }
  110.  
  111. void number_five(int xoffset, struct Window *win)
  112. {
  113.     DrawBorder( win->RPort, &hfiller_border, xoffset+3,    Y );
  114.     DrawBorder( win->RPort, &vfiller_border, xoffset,   Y+3 );
  115.     DrawBorder( win->RPort, &hfiller_border, xoffset+3,    Y+14 );
  116.     DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+17 );
  117.     DrawBorder( win->RPort, &hfiller_border, xoffset+3,    Y+28 );
  118. }
  119.  
  120. void number_six(int xoffset, struct Window *win)
  121. {
  122.     DrawBorder( win->RPort, &hfiller_border, xoffset+3,    Y );
  123.     DrawBorder( win->RPort, &vfiller_border, xoffset,   Y+3 );
  124.     DrawBorder( win->RPort, &hfiller_border, xoffset+3,    Y+14 );
  125.     DrawBorder( win->RPort, &vfiller_border, xoffset,   Y+17 );
  126.     DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+17 );
  127.     DrawBorder( win->RPort, &hfiller_border, xoffset+3,    Y+28 );
  128. }
  129.  
  130. void number_seven(int xoffset, struct Window *win)
  131. {
  132.     DrawBorder( win->RPort, &hfiller_border, xoffset+3,    Y );
  133.     DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+3 );
  134.     DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+17 );
  135. }
  136.  
  137. void number_eight(int xoffset, struct Window *win)
  138. {
  139.     DrawBorder( win->RPort, &hfiller_border, xoffset+3,    Y );
  140.     DrawBorder( win->RPort, &vfiller_border, xoffset,   Y+3 );
  141.     DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+3 );
  142.     DrawBorder( win->RPort, &hfiller_border, xoffset+3,    Y+14 );
  143.     DrawBorder( win->RPort, &vfiller_border, xoffset,   Y+17 );
  144.     DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+17 );
  145.     DrawBorder( win->RPort, &hfiller_border, xoffset+3,    Y+28 );
  146. }
  147.  
  148. void number_nine(int xoffset, struct Window *win)
  149. {
  150.     DrawBorder( win->RPort, &hfiller_border, xoffset+3,    Y );
  151.     DrawBorder( win->RPort, &vfiller_border, xoffset,   Y+3 );
  152.     DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+3 );
  153.     DrawBorder( win->RPort, &hfiller_border, xoffset+3,    Y+14 );
  154.     DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+17 );
  155.     DrawBorder( win->RPort, &hfiller_border, xoffset+3,    Y+28 );
  156. }
  157.  
  158. void number_zero(int xoffset, struct Window *win)
  159. {
  160.     DrawBorder( win->RPort, &hfiller_border, xoffset+3,    Y );
  161.     DrawBorder( win->RPort, &vfiller_border, xoffset,   Y+3 );
  162.     DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+3 );
  163.     DrawBorder( win->RPort, &vfiller_border, xoffset,   Y+17 );
  164.     DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+17 );
  165.     DrawBorder( win->RPort, &hfiller_border, xoffset+3,    Y+28 );
  166. }
  167.  
  168. void dots(struct Window *win)
  169. {
  170.     DrawBorder( win->RPort, &dfiller_border,    DOTX, DOTY );
  171.     DrawBorder( win->RPort, &dfiller_border,    DOTX, DOTY+10 );
  172. }